﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Inspection.aspx.cs" Inherits="PPAP.Web.Todolist.Inspection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        .table
        {
            background-color: #F2F2F2;
            border: 1px;
            border-color: Gray;
            border-style: solid;
            height: 140px;
            width: 95%;
            vertical-align: top;
            margin-left: 5px;
        }
        .td1
        {
            font-weight: bold;
            border-color: #2A48CE;
            border: 0px;
            color: #2E8AC5;
            margin: 0;
        }
        .td2
        {
            border-color: #2A48CE;
            border: 0px;
            margin: 0;
            border-top-width: 0;
        }
        .td3
        {
            border-color: #2A48CE;
            border: 0px;
            margin: 0;
            border-top-width: 0;
            border-left-width: 0;
        }
    </style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;">
    <form id="form1" runat="server">
    <div>
        <table width="100%" runat="server" id="ta">
            <tr style="color: #000000; background-color: #E7E8E8; font-weight: bold; height: 28px;">
                <td colspan="4">
                    Sample card
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold; color: #2E8AC5; width: 20%; height: 25px;">
                    Sample card no.
                </td>
                <td style="width: 30%;">
                    <asp:Label ID="lblCardNo" runat="server"></asp:Label>
                </td>
                <td style="font-weight: bold; color: #2E8AC5; width: 20%;">
                    Department
                </td>
                <td style="width: 30%;">
                    <asp:Label ID="lblDepartment" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
        <table width="100%" >
            <tr style="color: #000000; background-color: #E7E8E8; font-weight: bold; height: 28px;">
                <td colspan="4">
                    Test items
                </td>
            </tr>
            <tr><td runat="server" >
                <asp:Label ID="Label9" runat="server"></asp:Label>
                </td></tr>
           
            <tr style="height:25px;">
            <td colspan="4" style="background-color: #FFFFCC"><img src="../Images/newimg/tishi.png" style="vertical-align: middle;" />Every 
                deviation from every individual test must be listed in &quot;reason for 
                deviation&quot;-field.</td>
            </tr>
        </table>
        <table width="100%" cellspacing="2" cellpadding="2">
            <tr style="color: #000000; background-color: #E7E8E8; font-weight: bold; height: 28px;">
                <td colspan="4">
                    Inspection
                </td>
            </tr>
            <tr>
                <td style="width: 18%;" bgcolor="#F2F2F2" class="td1">
                    Result
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtG" runat="server" GroupName="a" Text="GREEN-approved" />
                    <table class="table">
                        <tr>
                            <td>
                                Definition green:<br />
                                &nbsp;·100%acceptable for customer
                                <br />
                                ·Achieves 100% compliance creteria defined by department conducting the assessment
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtY" runat="server" GroupName="a" 
                        Text="YELLOW - conditionally approved" />
                    <table class="table">
                        <tr>
                            <td>
                                Definition yellow:<br />
                                &nbsp;·Suitable for customer
                                <br />
                                ·May remain in vehicle
                                <br />
                                ·Spec.non-conformity is present only on uncritical specifications
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtR" runat="server" GroupName="a" Text="RED - refused " />
                    <table class="table">
                        <tr>
                            <td>
                                Definition Red:
                                <br />
                                ·not suitable for customer
                                <br />
                                ·must not remain in vehicle
                                <br />
                                ·re-sampling required without delay
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td bgcolor="#F2F2F2" class="td1">
                    Reason for deviation
                </td>
                <td colspan="3" class="td2">
                <div  style="border: 1pt solid #2E8AC5; padding:15px 5px;  width:700px;word-wrap : break-word;word-break: break-all; overflow:hidden; " runat="server" id="txtReason2" visible="false"></div>
                    <asp:TextBox autocomplete="off"   ID="txtReason" runat="server"  
                        TextMode="MultiLine"  
                        style="word-wrap : break-word;word-break: break-all; overflow:hidden; " Width="99%"
                        OnTextChanged="txtReason_TextChanged" AutoPostBack="True" Rows="10"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td bgcolor="#F2F2F2" class="td1">
                    Internal Comment
                </td>
                <td colspan="3" class="td3">
                    <asp:TextBox autocomplete="off"   ID="txtInternalComment" runat="server" Width="99%" 
                        OnTextChanged="txtInternalComment_TextChanged" AutoPostBack="True"></asp:TextBox>
                </td>
            </tr>
        </table>
        <hr />
        <table width="100%">
            <tr>
                <td style="font-weight: bold;">
                    Upload inspection Report：
                </td>
                <td align="right">
                    <asp:Label ID="lblUp" runat="server" Visible="False"></asp:Label>
                </td>
            </tr>
            <tr style="height: 32px;" runat="server" id="trfile">
                <td align="right" style="font-weight: bold;" colspan="2">
                    File:
                    <asp:FileUpload ID="file" runat="server" Width="645px" />
                    <asp:Button ID="Button3" runat="server" CssClass="button" OnClick="Button3_Click"
                        Text="Upload" OnClientClick="return dis();" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4" Width="100%" ForeColor="#333333"
                        GridLines="None" AutoGenerateColumns="False">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="No." ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("rownum") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="File name" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <a href='<%# GetLink(Eval("F_URL").ToString()) %>' style="display: none;" target="_blank">
                                        <span style="color: Blue;">
                                            <%# Eval("F_Filename")%></span></a>
                                    <asp:LinkButton ID="LinkButton3" Visible="true" Text='<%# Eval("F_URL").ToString().Length>14?Eval("F_URL").ToString().Substring(14,Eval("F_URL").ToString().Length-14):Eval("F_URL") %>' ToolTip='<%#Eval("F_URL") %>' runat="server"
                                        OnClick="LinkButton2_Click"><%# Eval("F_Filename")%></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Size" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("filesize") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Create date" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:Label ID="Label8" runat="server" Text='<%#Eval("UpTime").ToString()==""?"":DateTime.Parse(Eval("UpTime").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Create by" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("UpBy") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" Visible='<%#Eval("F_ID").ToString()==""?false:false %>'
                                        runat="server" OnClientClick="return confirm('Please confirm to delete the file.')"
                                        PostBackUrl='<%# "Inspection.aspx?deid="+Eval("F_ID")%>'>Delete</asp:LinkButton>
                                    <img src="../Images/newimg/delete.png" title="Delete" onclick="<%#"javascript:del("+Eval("F_ID")+")" %>" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2E8AC5" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#E7E8E8" Font-Bold="True" ForeColor="#000000" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </td>
            </tr>
            </table>
            <hr />
            <table width="100%">
            <tr>
            <td colspan="2">
            <b>Approval process:</b>
            <asp:GridView ID="GridView2" runat="server" CellPadding="4" Width="100%" ForeColor="#333333"
                        GridLines="None" AutoGenerateColumns="False" >
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="No."  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("rownum") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="SampleCard" Visible="false"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%#Eval("testitemname") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Date"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("CREATETIME") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="User"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("CREATEUSER") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Action"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%#Eval("reamrk") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            
                        </Columns>
                        <EditRowStyle BackColor="#2E8AC5" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#E7E8E8" Font-Bold="True" ForeColor="#000000" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
            </td>
            </tr>
            <tr runat="server" id="trReason" visible="false"><td colspan="2"><b>Reason:</b><asp:TextBox 
                    autocomplete="off"   ID="txtResaon2" runat="server"  TextMode="MultiLine"  
                    style="word-wrap : break-word;word-break: break-all; overflow:hidden; " 
                    Width="100%" Rows="6"></asp:TextBox>
                </td></tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="Button2" runat="server" CssClass="button" Text="Submit" OnClientClick="return check();"
                        OnClick="Button2_Click" />&nbsp;
                    <asp:Button ID="btnApprove" runat="server" CssClass="button" Text="Approve" OnClick="btnApprove_Click"
                        OnClientClick="return confirm('Are you sure you want to approve?');" Visible="False" />
                    &nbsp;
                    <asp:Button ID="btnReject" runat="server" CssClass="button" Text="Reject" OnClick="btnReject_Click"
                        OnClientClick="return confirm('Are you sure you want to reject?');" Visible="False" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/jscript" language="javascript">
    function del(id) {
        if (id > 0) {
            if (confirm('Please confirm to delete the file.')) {
                url = "Inspection.aspx?deid=" + id;
                window.location.href = url;
            }
        }
    }

    function check() {
        var txtReason = document.getElementById("txtReason");
        var rbtG = document.getElementById("rbtG");
        var rbtR = document.getElementById("rbtR");
        var rbtY = document.getElementById("rbtY");
        if (!rbtG.checked && !rbtR.checked && !rbtY.checked) {
            alert("Please select reason");
            return false;

        }
        if (!rbtG.checked) {
            if (txtReason.value == "") {
                alert("'Reason for deviation' is mandatory for Yellow or Red result");
                txtReason.focus();
                return false;
            }
        }
        return confirm('Are you sure you want to submit?');
    }

    function dis() {
        if (confirm('Are you sure you want to upload?')) {
            var Button3 = document.getElementById("Button3");
            Button3.style.display = "none";
            return true;
        }
        else
            return false;
    }
</script>
</html>
